<template>
	<view>
		<view class="condition">
			<picker mode="date" :value="picker.value" @change="changeDate">
				<text>日期：</text>
				<text v-text="picker.value"></text>
				<icon class="iconfont iconarrow-right-copy-copy next"></icon>
			</picker>
			<searchBox  @searchFun="getList"></searchBox>
		</view>
		<view class="staticBox"></view>
		<menuList :menuInfo="menuInfo" class="list" :screenH="scrollH"></menuList>
	</view>
</template>

<script>
import searchBox from '@/wxcomponents/commonLayout/searchBox.vue';
import menuList from '@/wxcomponents/commonLayout/menuList.vue';
import { format, screenHeight } from '@/libs/common.js';
export default {
	data() {
		return {
			scrollH: screenHeight - 300,
			queryName: '',
			picker: {
				value: format('YY-mm-dd', new Date()),
				text: '请选择车牌号',
				mode: 'date', //picker的类型
				range: [] //picker的选项集合
			},
			menuInfo: {
				base: {
					tit: ['学生姓名', '生效时间'],
					menuProp: ['studentName', 'startTime'],
					class:'typeFour'
				},
				list: []
			}
		};
	},
	mounted() {
		this.getList();
	},
	methods: {
		changeDate(e) {
			this.picker.value = e.target.value;
		},
		async getList(queryName = this.queryName) {
			let that = this;
			let params = {
				queryDate: that.picker.value,
				queryName: queryName
			};
			let resp = await this.$http.post({
				url: '/stu/studentLeave/pagePassInfo',
				data: params
			});
			this.menuInfo.list = resp.result.records;
		}
	},
	components: {
		searchBox,
		menuList
	},
	watch: {
		'picker.value': {
			handler(n,o) {
				this.getList();
			}
		}
	}
};
</script>

<style lang="scss" scoped>
picker {
	display: flex;
	justify-content: center;
	text {
		line-height: 80upx;
		font-size: 32upx;
	}
}
.staticBox {
	width: 100%;
	height: 200upx;
}
.condition {
	position: fixed;
	top: 0;
	left: 0;
	margin-bottom: 200upx;
	width: 100%;
	z-index: 10;
	background: #fff;
}
.list {
	position: fixed;
	top: 200upx;
	width: 100%;
}
</style>
